import 'package:flutter/widgets.dart';
import 'package:flutter_basic/basic/basic_controller.dart';
import 'package:flutter_basic/modules/home/property_home/controller.dart';
import 'package:flutter_basic/modules/home/property_home/property_home_page.dart';
import 'package:flutter_basic/modules/home/property_list/controller.dart';
import 'package:flutter_basic/modules/home/property_list/property_list_page.dart';

class HomeController extends BasicController {
  String? _tag;
  int currentPage = 0;
  List<Widget> _pages = <Widget>[];
  PageController pageController = PageController(
    initialPage: 0,
    viewportFraction: 1,
    keepPage: true,
  );

  List<Widget> pages(String? tag) {
    if(_tag != tag){
      _tag = tag;
      _pages.clear();
    }
    if(_pages.isEmpty){
      _pages = <Widget>[
        PropertyHomePage.bind(PropertyHomePageController(), tag: tag),
        PropertyListPage.bind(PropertyListPageController(), tag: tag)
      ];
    }
    return _pages;
  }

  @override
  void onReady() {
    super.onReady();

  }
}